import {Base} from '../../utils/base.js';

class Order extends Base{
  constructor(){
    super();
    this._storageKeyName = 'newOrder';
  }

  /**
   * 下订单
   */
  doOrder(param,callback){
    var that = this;
    var params = {
      url:'order?XDEBUG_SESSION_START=16780',
      type:'post',
      data:{products:param},
      sCallBack:function(data){
        that.execSetStorageSync(true);
        callback && callback(data);
      }
    };
    this.request(params);
  }

  /**
   * 本地缓存 保存/更新
   */
  execSetStorageSync(data){
    wx.setStorageSync(this._storageKeyName, data);
  }
}

export {Order};